package priv.wjh.study.easyexcel.multisheet;

import com.alibaba.excel.write.handler.SheetWriteHandler;
import com.alibaba.excel.write.handler.context.SheetWriteHandlerContext;
import org.apache.poi.ss.usermodel.Sheet;

import java.util.function.Consumer;

public class MergeStrategy implements SheetWriteHandler {


    private Consumer<Sheet> consumer;

    public MergeStrategy(Consumer<Sheet> consumer) {
        this.consumer = consumer;
    }

    @Override
    public void afterSheetCreate(SheetWriteHandlerContext context) {
        Sheet sheet = context.getWriteSheetHolder()
                .getSheet();
        consumer.accept(sheet);
    }

}
